package com.googlecode.yonggemovie.widgets.imageviewer;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;

import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class ImageViewerPanel extends JPanel {

	private JPanel imageBoxPanel = new JPanel();// 图片箱面板
	
    public ImageViewerPanel() {
        this.setLayout(new BorderLayout());

        final JScrollPane scrollPane = new JScrollPane();// 创建一个滚动窗格

        scrollPane.setHorizontalScrollBarPolicy(
                JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);// 水平滚动条需要时可见

        scrollPane.setVerticalScrollBarPolicy(
                JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);// 垂直滚动条永远可见

        add(scrollPane, BorderLayout.CENTER);// 将滚动窗格添加到边框布局的中心

        JPanel panel = new JPanel();// 创建一个面板

        FlowLayout flowLayout = new FlowLayout();// 创建一个流式布局

        flowLayout.setHgap(2);// 设置水平间隔

        flowLayout.setVgap(2);// 设置垂直间隔

        panel.setLayout(flowLayout);// 采用流式布局

        scrollPane.setViewportView(panel);// 将面板添加到滚动窗格

        imageBoxPanel.setLayout(new GridLayout(0, 7, 0, 0));// 采用网格式布局

        panel.add(imageBoxPanel);// 将图片箱面板添加到面板
        

    }

	public JPanel getImageBoxPanel() {
		return imageBoxPanel;
	}
    
    
}
